﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Expand.Patterns.Command;
using SpellCaster3.Core;

namespace SpellCaster3.Commands
{
    class RemoveButtonMacroCommand : ICommand
    {
        private ButtonMacro _Receiver;
        private IList<ButtonMacro> _List;
        private int _Index;
        private HomeForm _Form;

        public RemoveButtonMacroCommand(HomeForm form, ButtonMacro receiver, IList<ButtonMacro> list, int index)
        {
            _Receiver = receiver;
            _List = list;
            _Index = index;
            _Form = form;
        }

        public object Receiver
        {
            get { return _Receiver; }
        }

        public void Execute()
        {
            _List.RemoveAt(_Index);
            _Form.DeleteIconForm(_Receiver);
        }

        public void UnExecute()
        {
            _Form.NewIconForm(_Receiver);
            _List.Insert(_Index, _Receiver);
        }
    }
}
